package priv.pront.code.mati.province;

import java.util.Scanner;

/**
 * @Description:
 * @Author: pront
 * @Time:2023-11-17 11:19
 */
// FIXME
public class MC0210_安全认证 {

    static String s, s2 = "", ans = "";

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        s = scanner.next();
        for (int i = 0; i < s.length() / 2; i++) {
            String pre = s.substring(0, i + 1);
            String suf = s.substring(s.length() - i - 1);
            if(pre.equals(suf)){
                String s1 = s.substring(pre.length() - 1, s.length() - suf.length());
                if(getIndexOf(s1, pre) != -1){
                    ans = pre;
                }
            }
        }
        System.out.println(ans.equals("") ? "No" : ans);

    }
    private static int getIndexOf(String s1, String s2) {
        if (s1 == null || s2 == null || s1.length() < 1 || s1.length() < s2.length()) {
            return -1;
        }
        char[] c1 = s1.toCharArray();
        char[] c2 = s2.toCharArray();
        int i1 = 0;
        int i2 = 0;
        int[] next = getNextArr(c2);
        while (i1 < c1.length && i2 < c2.length) {
            if (c1[i1] == c2[i2]) {
                i1++;
                i2++;
            } else if (next[i2] > 0) {
                i2 = next[i2];
            } else {
                i1++;
            }
        }
        return i2 == c2.length ? i1 - i2 : -1;
    }



    private static int[] getNextArr(char[]cm){
        if (cm.length <= 1) {
            return new int[]{-1};
        }
        int[] next = new int[cm.length];
        next[0] = -1;
        next[1] = 0;
        int i = 2;
        int cn = 0;
        while (i < next.length) {
            if (cm[cn] == cm[i - 1]) {
                next[i++] = ++cn;
            } else if (cn > 0) {
                cn = next[cn];
            } else {
                i++;
            }
        }
        return next;
    }


}
